/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package Principal;

import clases.Conexion;
import clases.ImagenFondo;
import clases.SVGestorConexiones;
import clases.SVServidor;
import java.sql.Connection;
import javax.swing.ImageIcon;
import javax.swing.JOptionPane;

/**
 *
 * @author Juan
 */
public class frmPrincipal extends javax.swing.JFrame {

    /**
     * Creates new form frmPrincipal
     */
    
    public frmPrincipal() {
        initComponents();
        setLocationRelativeTo(null);
        //evita cerrar Fondo con ALT+C
        this.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
        try{
          this.setIconImage(new ImageIcon(getClass().getResource("icono.png")).getImage());
        
        }catch(Exception e){
            
        } 
        escritorio.setBorder(new ImagenFondo());
    }
    Conexion c = new Conexion();
    Connection cn =c.conectar();
    

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        escritorio = new javax.swing.JDesktopPane();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jmuAgregarUsuario = new javax.swing.JMenuItem();
        jmuMaquinasActivas = new javax.swing.JMenuItem();
        jSeparator1 = new javax.swing.JPopupMenu.Separator();
        jmuSalir = new javax.swing.JMenuItem();
        jMenu3 = new javax.swing.JMenu();
        jMenuItem1 = new javax.swing.JMenuItem();
        jmuNombre = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();
        jmuAsistenciaRemota = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Servicios Virtuales");

        javax.swing.GroupLayout escritorioLayout = new javax.swing.GroupLayout(escritorio);
        escritorio.setLayout(escritorioLayout);
        escritorioLayout.setHorizontalGroup(
            escritorioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 694, Short.MAX_VALUE)
        );
        escritorioLayout.setVerticalGroup(
            escritorioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 431, Short.MAX_VALUE)
        );

        jMenu1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/1424392513_archive.png"))); // NOI18N
        jMenu1.setText("Archivo");

        jmuAgregarUsuario.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_A, java.awt.event.InputEvent.CTRL_MASK));
        jmuAgregarUsuario.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/1424392610_Edit-Male-User.png"))); // NOI18N
        jmuAgregarUsuario.setText("Agregar Usuario");
        jmuAgregarUsuario.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmuAgregarUsuarioActionPerformed(evt);
            }
        });
        jMenu1.add(jmuAgregarUsuario);

        jmuMaquinasActivas.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_Q, java.awt.event.InputEvent.CTRL_MASK));
        jmuMaquinasActivas.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/1424576123_server.png"))); // NOI18N
        jmuMaquinasActivas.setText("Maquinas Activas");
        jmuMaquinasActivas.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmuMaquinasActivasActionPerformed(evt);
            }
        });
        jMenu1.add(jmuMaquinasActivas);
        jMenu1.add(jSeparator1);

        jmuSalir.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.CTRL_MASK));
        jmuSalir.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/1424464366_Close_Box_Red.png"))); // NOI18N
        jmuSalir.setText("Salir");
        jmuSalir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmuSalirActionPerformed(evt);
            }
        });
        jMenu1.add(jmuSalir);

        jMenuBar1.add(jMenu1);

        jMenu3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/1424575973_mycomputer.png"))); // NOI18N
        jMenu3.setText("Control Maquinas");

        jMenuItem1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_M, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/1424576036_Admin.png"))); // NOI18N
        jMenuItem1.setText("Maquinas");
        jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu3.add(jMenuItem1);

        jmuNombre.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_E, java.awt.event.InputEvent.CTRL_MASK));
        jmuNombre.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/1424685291_Account_card.png"))); // NOI18N
        jmuNombre.setText("Nombre de la Empresa");
        jmuNombre.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmuNombreActionPerformed(evt);
            }
        });
        jMenu3.add(jmuNombre);

        jMenuBar1.add(jMenu3);

        jMenu2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/1424464431_Male-User-Help.png"))); // NOI18N
        jMenu2.setText("Ayuda");

        jmuAsistenciaRemota.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_Y, java.awt.event.InputEvent.CTRL_MASK));
        jmuAsistenciaRemota.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/1424464511_Businessman.png"))); // NOI18N
        jmuAsistenciaRemota.setText("Asistencia Remota");
        jmuAsistenciaRemota.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmuAsistenciaRemotaActionPerformed(evt);
            }
        });
        jMenu2.add(jmuAsistenciaRemota);

        jMenuBar1.add(jMenu2);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(escritorio)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(escritorio)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jmuAgregarUsuarioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmuAgregarUsuarioActionPerformed
        // TODO add your handling code here:
        frmUsuarios a= new frmUsuarios();
        escritorio.add(a);
        a.show();
    }//GEN-LAST:event_jmuAgregarUsuarioActionPerformed

    private void jmuSalirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmuSalirActionPerformed
        // TODO add your handling code here:
        System.exit(0);
    }//GEN-LAST:event_jmuSalirActionPerformed

    private void jmuAsistenciaRemotaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmuAsistenciaRemotaActionPerformed
        // TODO add your handling code here:
        JOptionPane.showMessageDialog(rootPane, "Llame al 22 91 74 80 24");
    }//GEN-LAST:event_jmuAsistenciaRemotaActionPerformed

    private void jmuMaquinasActivasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmuMaquinasActivasActionPerformed
        // TODO add your handling code here:
        frmMaquinasActivas a = new frmMaquinasActivas();
        escritorio.add(a);
        a.show();
    }//GEN-LAST:event_jmuMaquinasActivasActionPerformed

    private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
        // TODO add your handling code here:
        frmMaquinas a = new frmMaquinas();
        escritorio.add(a);
        a.show();
    }//GEN-LAST:event_jMenuItem1ActionPerformed

    private void jmuNombreActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmuNombreActionPerformed
        // TODO add your handling code here:
        frmEmpresa a = new frmEmpresa();
        escritorio.add(a);
        a.show();
    }//GEN-LAST:event_jmuNombreActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(frmPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(frmPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(frmPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(frmPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new frmPrincipal().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JDesktopPane escritorio;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenu jMenu3;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JPopupMenu.Separator jSeparator1;
    private javax.swing.JMenuItem jmuAgregarUsuario;
    private javax.swing.JMenuItem jmuAsistenciaRemota;
    private javax.swing.JMenuItem jmuMaquinasActivas;
    private javax.swing.JMenuItem jmuNombre;
    private javax.swing.JMenuItem jmuSalir;
    // End of variables declaration//GEN-END:variables
}
